/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package it.polimi.weatherEver.gui.security;

import it.polimi.weatherEver.business.boundary.EventManager;
import it.polimi.weatherEver.business.entity.Event;
import javax.ejb.EJB;
import javax.ejb.Stateful;
import javax.inject.Named;

/**
 *
 * @author Ettore
 */
@Stateful
@Named
public class EventBean {
    @EJB
    private EventManager em;
    
    private Event event;
    
    public Event getEvent() {
        if (event == null) {
            event = new Event();
        }
        return event;
    }

    public void setEvent(Event event){
        this.event=event;
    }
    
    public String saveEvent(){
        em.save(event);
        return "user/home?faces-redirect=true";
    }
    
    // Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Business Method")
}
